define(['jquery', 'knockout',  'text!./report.html', 'uui','select', 'selecti18n', 'director', 'grid'],
    function ($, ko, template) {
        console.log("define:" +new Date().getTime());


        //使下来列表框有效
        // $(document).ready(function () {
        //     $('.selectpicker').selectpicker({
        //         style: 'btn-primary'
        //     });
        //
        // });

        // domReady(function () {
        //     $('.selectpicker').selectpicker({
        //     });
        // });

        var init;
        var viewModel = {
            data: ko.observable({}),
            reportTypeDataTable: new u.DataTable({
                meta: {
                    'nd': {},
                    'reportType': {},
                    'reportTypeName': {},
                    'seqNo': {}
                }
            })
        };

        viewModel.getAllReportType = function () {
            app.serverEvent().addDataTable("reportTypeDataTable", "all").fire({
                url: $ctx + '/evt/dispatch',
                ctrl: 'baseData.reportType.reportTypeController',
                method: 'loadReportType',
                success: function (data) {
                }
            })
        };

        init = function () {
            console.log("init1:" +new Date().getTime());
            ko.cleanNode($('.content')[0]);
            app = u.createApp(
                {
                    el: '.content',
                    model: viewModel
                }
            );

            $('.selectpicker').selectpicker({
            });

            viewModel.getAllReportType();
        };

        viewModel.fun1 = function () {
            console.log("fun1");
            console.log($('#select-report').val());
        };

        viewModel.selectChanged = $('#select-report').on('changed.bs.select', function (e) {
            console.log("changed.bs.select");

        });

        $('#select-report').on('show.bs.select', function (e) {
            console.log("show.bs.select");
        });

        viewModel.fun3 = function () {
            console.log("fun3");
        };

        return {
            'model': viewModel,
            'template': template,
            'init': init
        };
    }
);
